<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Pac-Man: Riferimenti per il file io.cc</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="pacman_header.jpg"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Pac-Man
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generato da Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Cerca');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Pagina&#160;Principale</span></a></li>
      <li><a href="annotated.html"><span>Classi</span></a></li>
      <li class="current"><a href="files.html"><span>File</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Cerca" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Elenco&#160;dei&#160;file</span></a></li>
      <li><a href="globals.html"><span>Elementi&#160;dei&#160;file</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tutto</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classi</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>File</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funzioni</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variabili</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Ridefinizioni di tipo (typedef)</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Tipi enumerati (enum)</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Valori del tipo enumerato</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pagine</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Funzioni</a>  </div>
  <div class="headertitle">
<div class="title">Riferimenti per il file io.cc</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;iostream&gt;</code><br/>
<code>#include &lt;fstream&gt;</code><br/>
<code>#include &lt;cstring&gt;</code><br/>
<code>#include &lt;allegro5/allegro.h&gt;</code><br/>
<code>#include &lt;allegro5/allegro_primitives.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="data__struct_8h_source.html">data_struct.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="logic_8h_source.html">logic.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="gui_8h_source.html">gui.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="init_8h_source.html">init.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Funzioni</h2></td></tr>
<tr class="memitem:a6cc7e5402d075aeecd086dcc4aaa54a5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a6cc7e5402d075aeecd086dcc4aaa54a5">agg_tasti</a> (ALLEGRO_EVENT &amp;event, bool tasto[], bool setting)</td></tr>
<tr class="memdesc:a6cc7e5402d075aeecd086dcc4aaa54a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">La funzione setta i valori booleani dell'array tasto inizializzato nel <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, a seconda se il tasto è stato premuto o rilasciato.  <a href="#a6cc7e5402d075aeecd086dcc4aaa54a5">Continua...</a><br/></td></tr>
<tr class="separator:a6cc7e5402d075aeecd086dcc4aaa54a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a740ad2e5687b1e22256119003467b4c2"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a740ad2e5687b1e22256119003467b4c2">alloca_mappa</a> (<a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;m)</td></tr>
<tr class="memdesc:a740ad2e5687b1e22256119003467b4c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Funzione che alloca la memoria necessaria al caricamento della mappa da file.  <a href="#a740ad2e5687b1e22256119003467b4c2">Continua...</a><br/></td></tr>
<tr class="separator:a740ad2e5687b1e22256119003467b4c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5811193309b350af82365fe506add6cf"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a5811193309b350af82365fe506add6cf">dealloca_mappa</a> (<a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;m)</td></tr>
<tr class="memdesc:a5811193309b350af82365fe506add6cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Funzione che dealloca la matrice mappa in memoria.  <a href="#a5811193309b350af82365fe506add6cf">Continua...</a><br/></td></tr>
<tr class="separator:a5811193309b350af82365fe506add6cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a66aaceaba8d215e5d7cdd231291c2a4d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a66aaceaba8d215e5d7cdd231291c2a4d">load_map</a> (<a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;m, char fileliv[], int livello)</td></tr>
<tr class="memdesc:a66aaceaba8d215e5d7cdd231291c2a4d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Carica la mappa da un file contenuto nella cartella data/map/.  <a href="#a66aaceaba8d215e5d7cdd231291c2a4d">Continua...</a><br/></td></tr>
<tr class="separator:a66aaceaba8d215e5d7cdd231291c2a4d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a689b2b0934cdf05a929ee230e0d3e677"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a689b2b0934cdf05a929ee230e0d3e677">preleva_record</a> ()</td></tr>
<tr class="memdesc:a689b2b0934cdf05a929ee230e0d3e677"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prende in ingresso da un file di salvataggio (sav.txt) il record fatto in precedenza.  <a href="#a689b2b0934cdf05a929ee230e0d3e677">Continua...</a><br/></td></tr>
<tr class="separator:a689b2b0934cdf05a929ee230e0d3e677"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9bf9fb1ff574b0a3cccaa15eedebc87e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8cc.html#a9bf9fb1ff574b0a3cccaa15eedebc87e">salva_record</a> (int new_record)</td></tr>
<tr class="memdesc:a9bf9fb1ff574b0a3cccaa15eedebc87e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scrive sul file di salvataggio (sav.txt) il record.  <a href="#a9bf9fb1ff574b0a3cccaa15eedebc87e">Continua...</a><br/></td></tr>
<tr class="separator:a9bf9fb1ff574b0a3cccaa15eedebc87e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Documentazione delle funzioni</h2>
<a class="anchor" id="a6cc7e5402d075aeecd086dcc4aaa54a5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void agg_tasti </td>
          <td>(</td>
          <td class="paramtype">ALLEGRO_EVENT &amp;&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>tasto</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>setting</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>La funzione setta i valori booleani dell'array tasto inizializzato nel <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, a seconda se il tasto è stato premuto o rilasciato. </p>
<p>Viene eseguito nella funzione <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, una volta per assegnare a setting true, se un tasto (tra quelli predefiniti) viene premuti,un'altra volta per assegnare a setting false, quando questo tasto viene rilasciato. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">event</td><td>variabile utilizzata contenente l'evento dei tasti </td></tr>
    <tr><td class="paramname">tasto</td><td>array contenente lo stato dei tasti premuti o rilasciati </td></tr>
    <tr><td class="paramname">setting</td><td>valore da attribuire al campo booleano dell'array ::tasto </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>void. </dd></dl>
<div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keywordflow">switch</span>(event.keyboard.keycode)</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_UP:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caba595d8bca8bc5e67c37c0a9d89becfa">UP</a>] = setting;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_DOWN:</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca9b0b4a95b99523966e0e34ffdadac9da">DOWN</a>] = setting;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_RIGHT:</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caec8379af7490bb9eaaf579cf17876f38">RIGHT</a>] = setting;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_LEFT:</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959cadb45120aafd37a973140edee24708065">LEFT</a>] = setting;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_ENTER:</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca951ab68bb8f7daafb78951107080904e">ENTER</a>] = setting;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_D:</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca77a6b11f9898c052926f1d49765861e8">D</a>] = setting;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                <span class="keywordflow">case</span> ALLEGRO_KEY_ESCAPE:</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                        tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca0a311695a4f6c56869245418bebeb33d">ESCAPE</a>] = setting;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        <span class="keywordflow">case</span> ALLEGRO_KEY_SPACE:</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959cac08dae7edcb5c5bb959fee5971fbad95">SPACE</a>] = setting;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        <span class="keywordflow">case</span> ALLEGRO_KEY_P:</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;            tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca82f05f38f6a17b117cdd2b83227912c6">P</a>] = setting;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="keywordflow">case</span> ALLEGRO_KEY_S:</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            tasto[<a class="code" href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caf1ce01387d2348f8b858721a7db81670">S</a>] = setting;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        }</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;}</div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959cadb45120aafd37a973140edee24708065"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959cadb45120aafd37a973140edee24708065">LEFT</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959ca77a6b11f9898c052926f1d49765861e8"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca77a6b11f9898c052926f1d49765861e8">D</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959caba595d8bca8bc5e67c37c0a9d89becfa"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caba595d8bca8bc5e67c37c0a9d89becfa">UP</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959caf1ce01387d2348f8b858721a7db81670"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caf1ce01387d2348f8b858721a7db81670">S</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959cac08dae7edcb5c5bb959fee5971fbad95"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959cac08dae7edcb5c5bb959fee5971fbad95">SPACE</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959ca9b0b4a95b99523966e0e34ffdadac9da"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca9b0b4a95b99523966e0e34ffdadac9da">DOWN</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959ca951ab68bb8f7daafb78951107080904e"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca951ab68bb8f7daafb78951107080904e">ENTER</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959ca82f05f38f6a17b117cdd2b83227912c6"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca82f05f38f6a17b117cdd2b83227912c6">P</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959ca0a311695a4f6c56869245418bebeb33d"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959ca0a311695a4f6c56869245418bebeb33d">ESCAPE</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
<div class="ttc" id="data__struct_8h_html_a9c87ca40e543ebbb6e33116215d4959caec8379af7490bb9eaaf579cf17876f38"><div class="ttname"><a href="data__struct_8h.html#a9c87ca40e543ebbb6e33116215d4959caec8379af7490bb9eaaf579cf17876f38">RIGHT</a></div><div class="ttdef"><b>Definition:</b> data_struct.h:34</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a740ad2e5687b1e22256119003467b4c2"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void alloca_mappa </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;&#160;</td>
          <td class="paramname"><em>m</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Funzione che alloca la memoria necessaria al caricamento della mappa da file. </p>
<p>Eseguita dalla funzione <a class="el" href="io_8cc.html#a66aaceaba8d215e5d7cdd231291c2a4d" title="Carica la mappa da un file contenuto nella cartella data/map/. ">load_map</a> per allocare la mappa. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">m</td><td>variabile contenente le informazioni riguardanti la mappa di gioco di tipo MAPPA_T. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>void. </dd></dl>
<div class="fragment"><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;{</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a> = <span class="keyword">new</span> <span class="keywordtype">char</span> *[m.<a class="code" href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">r</a>];</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i&lt;m.<a class="code" href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">r</a>; i++)</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a>[i] = <span class="keyword">new</span> <span class="keywordtype">char</span>[m.<a class="code" href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">c</a> +1];</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;}</div>
<div class="ttc" id="structMAPPA__t_html_ab2e9ea9798d2de75538abca11cb7372d"><div class="ttname"><a href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">MAPPA_t::mappa</a></div><div class="ttdeci">char ** mappa</div><div class="ttdoc">Matrice che definisce la mappa. </div><div class="ttdef"><b>Definition:</b> data_struct.h:46</div></div>
<div class="ttc" id="structMAPPA__t_html_a2644bce73327c50b0538aac5a9039c54"><div class="ttname"><a href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">MAPPA_t::c</a></div><div class="ttdeci">int c</div><div class="ttdoc">Numero di Righe. </div><div class="ttdef"><b>Definition:</b> data_struct.h:45</div></div>
<div class="ttc" id="structMAPPA__t_html_a66ed78e0a589ef13ecb5e82ec4097934"><div class="ttname"><a href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">MAPPA_t::r</a></div><div class="ttdeci">int r</div><div class="ttdoc">Numero di Colonne. </div><div class="ttdef"><b>Definition:</b> data_struct.h:44</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a5811193309b350af82365fe506add6cf"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void dealloca_mappa </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;&#160;</td>
          <td class="paramname"><em>m</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Funzione che dealloca la matrice mappa in memoria. </p>
<p>Viene eseguita dalla funzione <a class="el" href="io_8cc.html#a66aaceaba8d215e5d7cdd231291c2a4d" title="Carica la mappa da un file contenuto nella cartella data/map/. ">load_map</a> per deallocare una mappa nel caso in cui fosse stata allocata in precedenza. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">m</td><td>variabile contenente le informazioni riguardanti la mappa di gioco di tipo MAPPA_T. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>void. </dd></dl>
<div class="fragment"><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;{</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">r</a>; i++){</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        <span class="keyword">delete</span> [] m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a>[i];</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    }</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keyword">delete</span> [] m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a>;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a> = NULL;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;}</div>
<div class="ttc" id="structMAPPA__t_html_ab2e9ea9798d2de75538abca11cb7372d"><div class="ttname"><a href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">MAPPA_t::mappa</a></div><div class="ttdeci">char ** mappa</div><div class="ttdoc">Matrice che definisce la mappa. </div><div class="ttdef"><b>Definition:</b> data_struct.h:46</div></div>
<div class="ttc" id="structMAPPA__t_html_a66ed78e0a589ef13ecb5e82ec4097934"><div class="ttname"><a href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">MAPPA_t::r</a></div><div class="ttdeci">int r</div><div class="ttdoc">Numero di Colonne. </div><div class="ttdef"><b>Definition:</b> data_struct.h:44</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a66aaceaba8d215e5d7cdd231291c2a4d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void load_map </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structMAPPA__t.html">MAPPA_t</a> &amp;&#160;</td>
          <td class="paramname"><em>m</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>fileliv</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>livello</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Carica la mappa da un file contenuto nella cartella data/map/. </p>
<p>A fileliv viene assegnata la prima parte della stringa del percorso dove risiede il file contenente la mappa, successivamente gli viene assegnato il valore del livello convertito in una stringa, scritto prima su una stringa provvisoria (buff), in fine a fileliv viene assegnata l'ultima parte del percorso. Dopo di che viene aperto il file di nome fileliv per leggere una matrice che sarà poi la mappa del gioco.</p>
<p>La funzione viene eseguita dalla funzione <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, ogni volta che si attiva la variabile booleana caricamappa nello stato stato di gioco <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a348ee0b12aa2add36de34a33d06c2a52">CARICA</a>. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">m</td><td>variabile contenente le informazioni riguardanti la mappa di gioco di tipo MAPPA_T </td></tr>
    <tr><td class="paramname">fileliv</td><td>variabile che viene modificata per contenere il nome del file in base al livello </td></tr>
    <tr><td class="paramname">livello</td><td>livello corrente in gioco. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>void. </dd></dl>
<div class="fragment"><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="comment">//trovo il nome del file per la mappa del determinato livello</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    strcpy(fileliv,<span class="stringliteral">&quot;data/map/map&quot;</span>);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keywordtype">char</span> buff[20];</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    snprintf(buff, <span class="keyword">sizeof</span>(buff), <span class="stringliteral">&quot;%d&quot;</span>, livello);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    strcat(fileliv,buff);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    strcat(fileliv,<span class="stringliteral">&quot;.txt&quot;</span>);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    ifstream f(fileliv);</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordflow">if</span>(!f)</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        cout&lt;&lt;<span class="stringliteral">&quot;file Error!&quot;</span>;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keywordflow">if</span>(m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a> != NULL)</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <a class="code" href="io_8cc.html#a5811193309b350af82365fe506add6cf">dealloca_mappa</a>(m);</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    f&gt;&gt;m.<a class="code" href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">r</a>&gt;&gt;m.<a class="code" href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">c</a>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <a class="code" href="io_8cc.html#a740ad2e5687b1e22256119003467b4c2">alloca_mappa</a>(m);</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; m.<a class="code" href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">r</a>; i++){</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; j &lt;= m.<a class="code" href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">c</a>; j++){</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            <span class="keywordflow">if</span>(j == m.<a class="code" href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">c</a>)</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a>[i][j] = 0;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;                f&gt;&gt;m.<a class="code" href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">mappa</a>[i][j];</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        }</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;}</div>
<div class="ttc" id="io_8cc_html_a5811193309b350af82365fe506add6cf"><div class="ttname"><a href="io_8cc.html#a5811193309b350af82365fe506add6cf">dealloca_mappa</a></div><div class="ttdeci">static void dealloca_mappa(MAPPA_t &amp;m)</div><div class="ttdoc">Funzione che dealloca la matrice mappa in memoria. </div><div class="ttdef"><b>Definition:</b> io.cc:79</div></div>
<div class="ttc" id="structMAPPA__t_html_ab2e9ea9798d2de75538abca11cb7372d"><div class="ttname"><a href="structMAPPA__t.html#ab2e9ea9798d2de75538abca11cb7372d">MAPPA_t::mappa</a></div><div class="ttdeci">char ** mappa</div><div class="ttdoc">Matrice che definisce la mappa. </div><div class="ttdef"><b>Definition:</b> data_struct.h:46</div></div>
<div class="ttc" id="structMAPPA__t_html_a2644bce73327c50b0538aac5a9039c54"><div class="ttname"><a href="structMAPPA__t.html#a2644bce73327c50b0538aac5a9039c54">MAPPA_t::c</a></div><div class="ttdeci">int c</div><div class="ttdoc">Numero di Righe. </div><div class="ttdef"><b>Definition:</b> data_struct.h:45</div></div>
<div class="ttc" id="io_8cc_html_a740ad2e5687b1e22256119003467b4c2"><div class="ttname"><a href="io_8cc.html#a740ad2e5687b1e22256119003467b4c2">alloca_mappa</a></div><div class="ttdeci">static void alloca_mappa(MAPPA_t &amp;m)</div><div class="ttdoc">Funzione che alloca la memoria necessaria al caricamento della mappa da file. </div><div class="ttdef"><b>Definition:</b> io.cc:67</div></div>
<div class="ttc" id="structMAPPA__t_html_a66ed78e0a589ef13ecb5e82ec4097934"><div class="ttname"><a href="structMAPPA__t.html#a66ed78e0a589ef13ecb5e82ec4097934">MAPPA_t::r</a></div><div class="ttdeci">int r</div><div class="ttdoc">Numero di Colonne. </div><div class="ttdef"><b>Definition:</b> data_struct.h:44</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a689b2b0934cdf05a929ee230e0d3e677"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int preleva_record </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Prende in ingresso da un file di salvataggio (sav.txt) il record fatto in precedenza. </p>
<p>Viene eseguita nel <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, negli stati di gioco <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a843dff91ff0b0e5b98a110a512b2f531">WIN</a> e <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a871723195985a4ae22d7e10d99bf8a00">GAME_OVER</a> nel caso in cui il giocatore ha fatto un nuovo punteggio record, oppure nello stato <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a668caa755f0257c865341db47993096f">HIGH_SCORE</a> quando un giocatore vuole vedere qual'e' stato il miglior punteggio. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">.</td><td>nessun parametro in ingresso. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>ritorna un valore intero che rappresenta il record. </dd></dl>
<div class="fragment"><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;{</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordtype">int</span> punt_sav;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    ifstream f(<a class="code" href="data__struct_8h.html#aa871f9ecb39da91f2333c782a9ed19f0">FILE_SAV</a>);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">if</span>(!f)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        cout&lt;&lt;<span class="stringliteral">&quot;file Error!&quot;</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    f&gt;&gt;punt_sav;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keywordflow">return</span> punt_sav;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;}</div>
<div class="ttc" id="data__struct_8h_html_aa871f9ecb39da91f2333c782a9ed19f0"><div class="ttname"><a href="data__struct_8h.html#aa871f9ecb39da91f2333c782a9ed19f0">FILE_SAV</a></div><div class="ttdeci">const char FILE_SAV[]</div><div class="ttdoc">Nome del file di salvataggio. </div><div class="ttdef"><b>Definition:</b> data_struct.h:23</div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a9bf9fb1ff574b0a3cccaa15eedebc87e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void salva_record </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>new_record</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Scrive sul file di salvataggio (sav.txt) il record. </p>
<p>Viene eseguita nel <a class="el" href="game_8cc.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>, negli stati di gioco <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a843dff91ff0b0e5b98a110a512b2f531">WIN</a> e <a class="el" href="data__struct_8h.html#a2b4fca65b06655936250de8523872c89a871723195985a4ae22d7e10d99bf8a00">GAME_OVER</a> nel caso in cui il giocatore ha fatto un nuovo punteggio record. </p>
<dl class="params"><dt>Parametri</dt><dd>
  <table class="params">
    <tr><td class="paramname">new_record</td><td>variabile contenente il valore del record </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Restituisce</dt><dd>void. </dd></dl>
<div class="fragment"><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;{</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    ofstream f(<a class="code" href="data__struct_8h.html#aa871f9ecb39da91f2333c782a9ed19f0">FILE_SAV</a>);</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    f&lt;&lt;new_record;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;}</div>
<div class="ttc" id="data__struct_8h_html_aa871f9ecb39da91f2333c782a9ed19f0"><div class="ttname"><a href="data__struct_8h.html#aa871f9ecb39da91f2333c782a9ed19f0">FILE_SAV</a></div><div class="ttdeci">const char FILE_SAV[]</div><div class="ttdoc">Nome del file di salvataggio. </div><div class="ttdef"><b>Definition:</b> data_struct.h:23</div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generato Mar 14 Ott 2014 18:28:45 per Pac-Man da &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
